package ui;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.DateField;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.Vector;

public class InformationAgentEntryScreen extends Form implements
		CommandListener {
	private Command confirmCommand;
	private Command exitCommand;
	private manager.AgentManagerMIDlet midlet;
	private Display display;
   private TextField tfNum;
	
	public InformationAgentEntryScreen(manager.AgentManagerMIDlet midlet,
										Display display){
		super("Confirmation Agent Entry Screen");
		this.midlet = midlet;
		this.display = display;
        this.confirmCommand = new Command("Confirm", Command.SCREEN,1);
        this.exitCommand = new Command("Exit", Command.EXIT, 1);
        this.addCommand(confirmCommand);
        this.addCommand(exitCommand);
        tfNum = new TextField("Enter in Info to send","",100,TextField.ANY);
        this.append(tfNum);
        this.setCommandListener(this);
	}
	
	public void commandAction(Command c, Displayable d) {
		if(c==exitCommand){
            this.midlet.exitRequested();
		}else if(c==confirmCommand){
			//Vector dest = new Vector(1);
			//dest.insertElementAt(tfNum.getString(), 0);
			//Send information agent
			GetDestinationStartScreen destinationStartScreen = 
									new GetDestinationStartScreen(midlet,
																	agent.Agent.TYPE_INFORMATION,
																	display,
																	new Vector(),
																	new Vector(),
																	tfNum.getString());
			display.setCurrent(destinationStartScreen);
		}

	}

}
